package com.exam.api.modules.metadata.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.exam.api.common.JsonToStringSerializer;
import com.exam.api.common.StringToJsonSerializer;
import com.exam.api.common.baseModule.domain.BaseDomain;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import java.io.Serial;
import java.io.Serializable;

/**
 * 元数据表
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("tbl_metadata")
@Schema(title = "TblMetadata对象", description = "元数据表")
public class TblMetadata extends BaseDomain implements Serializable {

    /**
     * 元数据Code
     */
    @TableField(value = "metadata_code")
    @Schema(description = "元数据Code")
    @Length(max = 30, message = "编码长度不能超过30")
    private String metadataCode;
    /**
     * 元数据
     */
    @TableField(value = "metadata")
    @Schema(description = "元数据")
    @JsonSerialize(using = StringToJsonSerializer.class)
    @JsonDeserialize(using = JsonToStringSerializer.class)
    private Object metadata;
    /**
     * 检查登录类型 详见 CheckLogin
     */
    @TableField(value = "check_login")
    @Schema(description = "检查登录类型 详见 CheckLogin")
    @Length(max = 50, message = "编码长度不能超过50")
    private String checkLogin;
    /**
     * 备注
     */
    @TableField(value = "comment")
    @Schema(description = "备注")
    @Length(max = 50, message = "编码长度不能超过50")
    private String comment;

    @Serial
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}
